package engine.gui;

public abstract class Component {
	
	private WindowManager windowManager;
	
	private int posX;
	private int posY;
	private int width;
	private int height;
	private boolean active;
	
	private GUIStyle ownStyle = null;
	private GUIStyle externalStyle = null;
	private boolean forceUseOwnStyle = false;
	
	public Component() {
		
	}
	
	public abstract void render(int x, int y, int width, int height);

	public abstract void reset();
	
	public int getPosX() {
		return posX;
	}

	public void setPosX(int posX) {
		this.posX = posX;
	}

	public int getPosY() {
		return posY;
	}

	public void setPosY(int posY) {
		this.posY = posY;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
	
	public boolean keyPressed(int key){
		return false;
	}
	
	public boolean keyReleased(int key){
		return false;
	}
	
	public boolean mousePressed(int posX, int posY, int button) {
		return false;
	}
	
	public boolean mouseReleased(int posX, int posY, int button) {
		return false;
	}
	
	public boolean mouseMoved(int posX, int posY, int button) {
		return false;
	}
	
	public boolean mouseDragged(int posX, int posY, int button) {
		return false;
	}
	
	public boolean mouseWheelMoved(int movement) {
		return false;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}
	
	public void activator() {
		
	}
	
	public void setForceUseOwnStyle(boolean forceUseOwnStyle) {
		this.forceUseOwnStyle = forceUseOwnStyle;
	}
	
	public boolean isForceUseOwnStyle() {
		return forceUseOwnStyle;
	}
	
	public void setExternalStyle(GUIStyle externalStyle) {
		this.externalStyle = externalStyle;
	}
	
	public GUIStyle getExternalStyle() {
		return externalStyle;
	}
	
	public void setOwnStyle(GUIStyle ownStyle) {
		this.ownStyle = ownStyle;
	}
	
	public GUIStyle getOwnStyle() {
		return ownStyle;
	}
	
	public GUIStyle getCurrentStyle() {
		return (!isForceUseOwnStyle() && getExternalStyle() != null) ? getExternalStyle() : getOwnStyle();
	}

	public WindowManager getWindowManager() {
		return windowManager;
	}

	public void setWindowManager(WindowManager windowManager) {
		this.windowManager = windowManager;
	}
}
